const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  mode: 'none',
  entry: {
    foo: './src/foo.js',
    bar: './src/bar.js'
  },
  output: {
    filename: 'js/[name].bundle.js'
  },
  optimization: {
    splitChunks: {
      chunks: 'all'
    }
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader']
      }
    ]
  },
  plugins: [
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin({
      filename: 'foo.html',
      chunks: ['foo']
    }),
    new HtmlWebpackPlugin({
      filename: 'bar.html',
      chunks: ['bar']
    })
  ]
}
